<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Markdown 拓展 | manoeasy</title>
    <meta name="generator" content="VuePress 1.7.1">
    <link rel="icon" href="/manoeasy/favicon.ico">
    <link rel="manifest" href="/manoeasy/manifest.json">
    <meta name="description" content="Vue-powered Static Site Generator">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
    <meta name="theme-color" content="#3eaf7c">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="msapplication-TileColor" content="#000000">
    
    <link rel="preload" href="/manoeasy/assets/css/0.styles.be905fd2.css" as="style"><link rel="preload" href="/manoeasy/assets/js/app.af965ea1.js" as="script"><link rel="preload" href="/manoeasy/assets/js/4.127e46f3.js" as="script"><link rel="preload" href="/manoeasy/assets/js/10.da3941ef.js" as="script"><link rel="preload" href="/manoeasy/assets/js/7.a765d265.js" as="script"><link rel="preload" href="/manoeasy/assets/js/5.49171081.js" as="script"><link rel="prefetch" href="/manoeasy/assets/js/11.b025af38.js"><link rel="prefetch" href="/manoeasy/assets/js/12.dbb059af.js"><link rel="prefetch" href="/manoeasy/assets/js/13.1a261b87.js"><link rel="prefetch" href="/manoeasy/assets/js/14.5a15bbc3.js"><link rel="prefetch" href="/manoeasy/assets/js/15.7b5c55db.js"><link rel="prefetch" href="/manoeasy/assets/js/16.6df6379b.js"><link rel="prefetch" href="/manoeasy/assets/js/17.516c2569.js"><link rel="prefetch" href="/manoeasy/assets/js/18.f0081dd1.js"><link rel="prefetch" href="/manoeasy/assets/js/19.4e4dad1d.js"><link rel="prefetch" href="/manoeasy/assets/js/20.3a3eefbb.js"><link rel="prefetch" href="/manoeasy/assets/js/21.297dfcc9.js"><link rel="prefetch" href="/manoeasy/assets/js/22.d6da5142.js"><link rel="prefetch" href="/manoeasy/assets/js/23.8325e7cd.js"><link rel="prefetch" href="/manoeasy/assets/js/24.563d8cc2.js"><link rel="prefetch" href="/manoeasy/assets/js/25.fc31765f.js"><link rel="prefetch" href="/manoeasy/assets/js/26.c8e63e62.js"><link rel="prefetch" href="/manoeasy/assets/js/27.cb0519da.js"><link rel="prefetch" href="/manoeasy/assets/js/28.f313e7c8.js"><link rel="prefetch" href="/manoeasy/assets/js/29.8201baa8.js"><link rel="prefetch" href="/manoeasy/assets/js/30.702cf160.js"><link rel="prefetch" href="/manoeasy/assets/js/31.2c8a92f6.js"><link rel="prefetch" href="/manoeasy/assets/js/32.a2d85e43.js"><link rel="prefetch" href="/manoeasy/assets/js/33.4ab3b2bb.js"><link rel="prefetch" href="/manoeasy/assets/js/34.ca38b0d3.js"><link rel="prefetch" href="/manoeasy/assets/js/35.7de7630a.js"><link rel="prefetch" href="/manoeasy/assets/js/36.0d78269f.js"><link rel="prefetch" href="/manoeasy/assets/js/37.45d789f0.js"><link rel="prefetch" href="/manoeasy/assets/js/38.796c3cfd.js"><link rel="prefetch" href="/manoeasy/assets/js/6.bf63a2b7.js"><link rel="prefetch" href="/manoeasy/assets/js/8.c83e8202.js"><link rel="prefetch" href="/manoeasy/assets/js/9.a0094280.js"><link rel="prefetch" href="/manoeasy/assets/js/vendors~flowchart.782f637e.js"><link rel="prefetch" href="/manoeasy/assets/js/vendors~notification.947e9dbe.js">
    <link rel="stylesheet" href="/manoeasy/assets/css/0.styles.be905fd2.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/manoeasy/" class="home-link router-link-active"><img src="/manoeasy/images/logo.png" alt="manoeasy" class="logo"> <span class="site-name can-hide">manoeasy</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/manoeasy/guide/" class="nav-link router-link-active">
  &lt;i class=&quot;el-icon-info&quot;&gt;&lt;/i&gt;指南
</a></div><div class="nav-item"><a href="/manoeasy/components/" class="nav-link">
  组件
</a></div><div class="nav-item"><a href="/manoeasy/github/" class="nav-link">
  项目
</a></div><div class="nav-item"><a href="/manoeasy/issue/" class="nav-link">
  issue
</a></div> <a href="https://github.com/algate/manoeasy" target="_blank" rel="noopener noreferrer" class="repo-link">
    Github
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/manoeasy/guide/" class="nav-link router-link-active">
  &lt;i class=&quot;el-icon-info&quot;&gt;&lt;/i&gt;指南
</a></div><div class="nav-item"><a href="/manoeasy/components/" class="nav-link">
  组件
</a></div><div class="nav-item"><a href="/manoeasy/github/" class="nav-link">
  项目
</a></div><div class="nav-item"><a href="/manoeasy/issue/" class="nav-link">
  issue
</a></div> <a href="https://github.com/algate/manoeasy" target="_blank" rel="noopener noreferrer" class="repo-link">
    Github
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav>  <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>指南</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/manoeasy/guide/" aria-current="page" class="sidebar-link">说明</a></li><li><a href="/manoeasy/guide/getting-started.html" class="sidebar-link">快速上手</a></li><li><a href="/manoeasy/guide/directory-structure.html" class="sidebar-link">目录结构</a></li><li><a href="/manoeasy/guide/basic-config.html" class="sidebar-link">基本配置</a></li><li><a href="/manoeasy/guide/assets.html" class="sidebar-link">静态资源</a></li><li><a href="/manoeasy/guide/markdown.html" aria-current="page" class="active sidebar-link">Markdown 拓展</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/manoeasy/guide/markdown.html#header-anchors" class="sidebar-link">Header Anchors</a></li><li class="sidebar-sub-header"><a href="/manoeasy/guide/markdown.html#链接" class="sidebar-link">链接</a></li><li class="sidebar-sub-header"><a href="/manoeasy/guide/markdown.html#front-matter" class="sidebar-link">Front Matter</a></li><li class="sidebar-sub-header"><a href="/manoeasy/guide/markdown.html#github-风格的表格" class="sidebar-link">GitHub 风格的表格</a></li><li class="sidebar-sub-header"><a href="/manoeasy/guide/markdown.html#emoji" class="sidebar-link">Emoji</a></li><li class="sidebar-sub-header"><a href="/manoeasy/guide/markdown.html#目录" class="sidebar-link">目录</a></li><li class="sidebar-sub-header"><a href="/manoeasy/guide/markdown.html#自定义容器" class="sidebar-link">自定义容器</a></li><li class="sidebar-sub-header"><a href="/manoeasy/guide/markdown.html#代码块中的语法高亮" class="sidebar-link">代码块中的语法高亮</a></li><li class="sidebar-sub-header"><a href="/manoeasy/guide/markdown.html#代码块中的行高亮" class="sidebar-link">代码块中的行高亮</a></li><li class="sidebar-sub-header"><a href="/manoeasy/guide/markdown.html#行号" class="sidebar-link">行号</a></li><li class="sidebar-sub-header"><a href="/manoeasy/guide/markdown.html#导入代码段" class="sidebar-link">导入代码段</a></li><li class="sidebar-sub-header"><a href="/manoeasy/guide/markdown.html#进阶配置" class="sidebar-link">进阶配置</a></li></ul></li><li><a href="/manoeasy/guide/using-vue.html" class="sidebar-link">在 Markdown 中 使用 Vue</a></li><li><a href="/manoeasy/guide/i18n.html" class="sidebar-link">多语言支持</a></li><li><a href="/manoeasy/guide/deploy.html" class="sidebar-link">部署</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>深入</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/manoeasy/guide/frontmatter.html" class="sidebar-link">Front Matter</a></li><li><a href="/manoeasy/guide/permalinks.html" class="sidebar-link">永久链接</a></li><li><a href="/manoeasy/guide/markdown-slot.html" class="sidebar-link">Markdown 插槽</a></li><li><a href="/manoeasy/guide/global-computed.html" class="sidebar-link">全局计算属性</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="markdown-拓展"><a href="#markdown-拓展" class="header-anchor">#</a> Markdown 拓展</h1> <h2 id="header-anchors"><a href="#header-anchors" class="header-anchor">#</a> Header Anchors</h2> <p>所有的标题将会自动地应用 anchor 链接，anchor 的渲染可以通过 <a href="/manoeasy/config/#markdown-anchor"><code>markdown.anchor</code></a> 来配置。</p> <h2 id="链接"><a href="#链接" class="header-anchor">#</a> 链接</h2> <h3 id="内部链接"><a href="#内部链接" class="header-anchor">#</a> 内部链接</h3> <p>网站内部的链接，将会被转换成 <code>&lt;router-link&gt;</code> 用于 SPA 导航。同时，站内的每一个文件夹下的 <code>README.md</code> 或者 <code>index.md</code> 文件都会被自动编译为 <code>index.html</code>，对应的链接将被视为 <code>/</code>。</p> <p>以如下的文件结构为例：</p> <div class="language- line-numbers-mode"><pre class="language-text"><code>.
├─ README.md
├─ foo
│  ├─ README.md
│  ├─ one.md
│  └─ two.md
└─ bar
   ├─ README.md
   ├─ three.md
   └─ four.md
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br></div></div><p>假设你现在在 <code>foo/one.md</code> 中：</p> <div class="language-md line-numbers-mode"><pre class="language-md"><code><span class="token url">[<span class="token content">Home</span>](/)</span> <span class="token comment">&lt;!-- 跳转到根部的 README.md --&gt;</span>
<span class="token url">[<span class="token content">foo</span>](/foo/)</span> <span class="token comment">&lt;!-- 跳转到 foo 文件夹的 index.html --&gt;</span>
<span class="token url">[<span class="token content">foo heading</span>](./#heading)</span> <span class="token comment">&lt;!-- 跳转到 foo/index.html 的特定标题位置 --&gt;</span>
<span class="token url">[<span class="token content">bar - three</span>](../bar/three.md)</span> <span class="token comment">&lt;!-- 具体文件可以使用 .md 结尾（推荐） --&gt;</span>
<span class="token url">[<span class="token content">bar - four</span>](../bar/four.html)</span> <span class="token comment">&lt;!-- 也可以用 .html --&gt;</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h3 id="链接的重定向"><a href="#链接的重定向" class="header-anchor">#</a> 链接的重定向</h3> <p>VuePress 支持重定向到干净链接。如果一个链接 <code>/foo</code> 找不到，VuePress 会自行寻找一个可用的 <code>/foo/</code> 或 <code>/foo.html</code>。反过来，当 <code>/foo/</code> 或 <code>/foo.html</code> 中的一个找不到时，VuePress 也会尝试寻找另一个。借助这种特性，我们可以通过官方插件 <a href="https://vuepress.github.io/plugins/clean-urls/" target="_blank" rel="noopener noreferrer">vuepress-plugin-clean-urls<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 定制你的网站路径。</p> <div class="custom-block tip"><p class="custom-block-title">注意</p> <p>无论是否使用了 permalink 和 clean-urls 插件，你的相对路径都应该依赖于当前的文件结构来定义。在上面的例子中，即使你将 <code>/foo/one.md</code> 的路径设为了 <code>/foo/one/</code>，你依然应该通过 <code>./two.md</code> 来访问 <code>/foo/two.md</code>。</p></div> <h3 id="外部链接"><a href="#外部链接" class="header-anchor">#</a> 外部链接</h3> <p>外部的链接将会被自动地设置为  <code>target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;</code>:</p> <ul><li><a href="https://vuejs.org" target="_blank" rel="noopener noreferrer">vuejs.org<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/vuejs/vuepress" target="_blank" rel="noopener noreferrer">VuePress on GitHub<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <p>你可以自定义通过配置 <a href="/manoeasy/config/#markdown-externallinks">config.markdown.externalLinks</a> 来自定义外部链接的特性。</p> <h2 id="front-matter"><a href="#front-matter" class="header-anchor">#</a> Front Matter</h2> <p>VuePress 提供了对 <a href="https://jekyllrb.com/docs/frontmatter/" target="_blank" rel="noopener noreferrer">YAML front matter<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 开箱即用的支持:</p> <div class="language-yaml line-numbers-mode"><pre class="language-yaml"><code><span class="token punctuation">---</span>
<span class="token key atrule">title</span><span class="token punctuation">:</span> Blogging Like a Hacker
<span class="token key atrule">lang</span><span class="token punctuation">:</span> en<span class="token punctuation">-</span>US
<span class="token punctuation">---</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p>这些数据可以在当前 markdown 的正文，或者是任意的自定义或主题组件中使用。</p> <p>想了解更多，请移步 <a href="/manoeasy/guide/frontmatter.html">Front Matter</a>。</p> <h2 id="github-风格的表格"><a href="#github-风格的表格" class="header-anchor">#</a> GitHub 风格的表格</h2> <p><strong>输入</strong></p> <div class="language- line-numbers-mode"><pre class="language-text"><code>| Tables        | Are           | Cool  |
| ------------- |:-------------:| -----:|
| col 3 is      | right-aligned | $1600 |
| col 2 is      | centered      |   $12 |
| zebra stripes | are neat      |    $1 |
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><p><strong>输出</strong></p> <table><thead><tr><th>Tables</th> <th style="text-align:center;">Are</th> <th style="text-align:right;">Cool</th></tr></thead> <tbody><tr><td>col 3 is</td> <td style="text-align:center;">right-aligned</td> <td style="text-align:right;">$1600</td></tr> <tr><td>col 2 is</td> <td style="text-align:center;">centered</td> <td style="text-align:right;">$12</td></tr> <tr><td>zebra stripes</td> <td style="text-align:center;">are neat</td> <td style="text-align:right;">$1</td></tr></tbody></table> <h2 id="emoji"><a href="#emoji" class="header-anchor">#</a> Emoji</h2> <p><strong>输入</strong></p> <div class="language- line-numbers-mode"><pre class="language-text"><code>:tada: :100:
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p><strong>输出</strong></p> <p>🎉 💯</p> <p>你可以在<a href="https://github.com/markdown-it/markdown-it-emoji/blob/master/lib/data/full.json" target="_blank" rel="noopener noreferrer">这个列表<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>找到所有可用的 Emoji。</p> <h2 id="目录"><a href="#目录" class="header-anchor">#</a> 目录</h2> <p><strong>输入</strong></p> <div class="language- line-numbers-mode"><pre class="language-text"><code>[[toc]]
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p><strong>输出</strong></p> <p></p><div class="table-of-contents"><ul><li><a href="#header-anchors">Header Anchors</a></li><li><a href="#链接">链接</a><ul><li><a href="#内部链接">内部链接</a></li><li><a href="#链接的重定向">链接的重定向</a></li><li><a href="#外部链接">外部链接</a></li></ul></li><li><a href="#front-matter">Front Matter</a></li><li><a href="#github-风格的表格">GitHub 风格的表格</a></li><li><a href="#emoji">Emoji</a></li><li><a href="#目录">目录</a></li><li><a href="#自定义容器-badge-text-默认主题">自定义容器 <span class="badge tip" style="vertical-align:top;" data-v-15b7b770>默认主题</span></a></li><li><a href="#代码块中的语法高亮">代码块中的语法高亮</a></li><li><a href="#代码块中的行高亮">代码块中的行高亮</a></li><li><a href="#行号">行号</a></li><li><a href="#导入代码段-badge-text-beta-type-warning">导入代码段 <span class="badge warning" style="vertical-align:top;" data-v-15b7b770>beta</span></a></li><li><a href="#进阶配置">进阶配置</a></li></ul></div><p></p> <p>目录（Table of Contents）的渲染可以通过  <a href="/manoeasy/config/#markdown-toc"><code>markdown.toc</code></a> 选项来配置。</p> <h2 id="自定义容器"><a href="#自定义容器" class="header-anchor">#</a> 自定义容器 <span class="badge tip" style="vertical-align:top;" data-v-15b7b770>默认主题</span></h2> <p><strong>输入</strong></p> <div class="language-md line-numbers-mode"><pre class="language-md"><code>::: tip
这是一个提示
:::

::: warning
这是一个警告
:::

::: danger
这是一个危险警告
:::

::: details
这是一个详情块，在 IE / Edge 中不生效
:::
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br></div></div><p><strong>输出</strong></p> <div class="custom-block tip"><p class="custom-block-title">TIP</p> <p>这是一个提示</p></div> <div class="custom-block warning"><p class="custom-block-title">WARNING</p> <p>这是一个警告</p></div> <div class="custom-block danger"><p class="custom-block-title">WARNING</p> <p>这是一个危险警告</p></div> <details class="custom-block details"><summary>DETAILS</summary> <p>这是一个详情块，在 IE / Edge 中不生效</p></details> <p>你也可以自定义块中的标题：</p> <div class="language-md line-numbers-mode"><pre class="language-md"><code>::: danger STOP
危险区域，禁止通行
:::

::: details 点击查看代码
<span class="token code"><span class="token punctuation">```</span><span class="token code-language">js</span>
<span class="token code-block language-js">console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">'你好，VuePress！'</span><span class="token punctuation">)</span></span>
<span class="token punctuation">```</span></span>
:::
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div><div class="custom-block danger"><p class="custom-block-title">STOP</p> <p>危险区域，禁止通行</p></div> <details class="custom-block details"><summary>点击查看代码</summary> <div class="language-js line-numbers-mode"><pre class="language-js"><code>console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">'你好，VuePress！'</span><span class="token punctuation">)</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div></details> <p><strong>参考:</strong></p> <ul><li><a href="https://vuepress.github.io/plugins/container/" target="_blank" rel="noopener noreferrer">vuepress-plugin-container<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <h2 id="代码块中的语法高亮"><a href="#代码块中的语法高亮" class="header-anchor">#</a> 代码块中的语法高亮</h2> <p>VuePress 使用了 <a href="https://prismjs.com/" target="_blank" rel="noopener noreferrer">Prism<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 来为 markdown 中的代码块实现语法高亮。Prism 支持大量的编程语言，你需要做的只是在代码块的开始倒勾中附加一个有效的语言别名：</p> <p><strong>输入</strong></p> <div class="language- line-numbers-mode"><pre class="language-text"><code>``` js
export default {
  name: 'MyComponent',
  // ...
}
```
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><p><strong>输出</strong></p> <div class="language-js line-numbers-mode"><pre class="language-js"><code><span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token punctuation">{</span>
  name<span class="token operator">:</span> <span class="token string">'MyComponent'</span><span class="token punctuation">,</span>
  <span class="token comment">// ...</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p><strong>输入</strong></p> <div class="language- line-numbers-mode"><pre class="language-text"><code>``` html
&lt;ul&gt;
  &lt;li
    v-for=&quot;todo in todos&quot;
    :key=&quot;todo.id&quot;
  &gt;
    {{ todo.text }}
  &lt;/li&gt;
&lt;/ul&gt;
```
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br></div></div><p><strong>输出</strong></p> <div class="language-html line-numbers-mode"><pre class="language-html"><code><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>ul</span><span class="token punctuation">&gt;</span></span>
  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>li</span>
    <span class="token attr-name">v-for</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>todo in todos<span class="token punctuation">&quot;</span></span>
    <span class="token attr-name">:key</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>todo.id<span class="token punctuation">&quot;</span></span>
  <span class="token punctuation">&gt;</span></span>
    {{ todo.text }}
  <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>li</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>ul</span><span class="token punctuation">&gt;</span></span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br></div></div><p>在 Prism 的网站上查看 <a href="https://prismjs.com/#languages-list" target="_blank" rel="noopener noreferrer">合法的语言列表<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>。</p> <h2 id="代码块中的行高亮"><a href="#代码块中的行高亮" class="header-anchor">#</a> 代码块中的行高亮</h2> <p><strong>输入</strong></p> <div class="language- line-numbers-mode"><pre class="language-text"><code>``` js {4}
export default {
  data () {
    return {
      msg: 'Highlighted!'
    }
  }
}
```
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br></div></div><p><strong>输出</strong></p> <div class="language-js line-numbers-mode"><div class="highlight-lines"><br><br><br><div class="highlighted"> </div><br><br><br><br></div><pre class="language-js"><code><span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token punctuation">{</span>
  <span class="token function">data</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token punctuation">{</span>
      msg<span class="token operator">:</span> <span class="token string">'Highlighted!'</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre><div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br></div></div><p>除了单行以外，你也可指定多行，行数区间，或是两者都指定。</p> <ul><li>行数区间: 例如 <code>{5-8}</code>, <code>{3-10}</code>, <code>{10-17}</code></li> <li>多个单行: 例如 <code>{4,7,9}</code></li> <li>行数区间与多个单行: 例如 <code>{4,7-13,16,23-27,40}</code></li></ul> <p><strong>Input</strong></p> <div class="language- line-numbers-mode"><pre class="language-text"><code>``` js{1,4,6-7}
export default { // Highlighted
  data () {
    return {
      msg: `Highlighted!
      This line isn't highlighted,
      but this and the next 2 are.`,
      motd: 'VuePress is awesome',
      lorem: 'ipsum',
    }
  }
}
```
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br></div></div><p><strong>Output</strong></p> <div class="language-js line-numbers-mode"><div class="highlight-lines"><div class="highlighted"> </div><br><br><div class="highlighted"> </div><br><div class="highlighted"> </div><div class="highlighted"> </div><div class="highlighted"> </div><br><br><br><br></div><pre class="language-js"><code><span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token punctuation">{</span> <span class="token comment">// Highlighted</span>
  <span class="token function">data</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
    <span class="token keyword">return</span> <span class="token punctuation">{</span>
      msg<span class="token operator">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">Highlighted!
      This line isn't highlighted,
      but this and the next 2 are.</span><span class="token template-punctuation string">`</span></span><span class="token punctuation">,</span>
      motd<span class="token operator">:</span> <span class="token string">'VuePress is awesome'</span><span class="token punctuation">,</span>
      lorem<span class="token operator">:</span> <span class="token string">'ipsum'</span><span class="token punctuation">,</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre><div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br></div></div><h2 id="行号"><a href="#行号" class="header-anchor">#</a> 行号</h2> <p>你可以通过配置来为每个代码块显示行号：</p> <div class="language-js line-numbers-mode"><pre class="language-js"><code>module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token punctuation">{</span>
  markdown<span class="token operator">:</span> <span class="token punctuation">{</span>
    lineNumbers<span class="token operator">:</span> <span class="token boolean">true</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div> <ul><li>示例:</li></ul> <picture><source srcset="/line-numbers-desktop.png" media="(min-width: 719px)"> <img alt="Image" class="line-numbers-desktop-snap"></picture> <picture><source srcset="/line-numbers-mobile.gif" media="(max-width: 719px)"> <img alt="Image" class="line-numbers-mobile-snap"></picture> <h2 id="导入代码段"><a href="#导入代码段" class="header-anchor">#</a> 导入代码段 <span class="badge warning" style="vertical-align:top;" data-v-15b7b770>beta</span></h2> <p>你可以通过下述的语法导入已经存在的文件中的代码段：</p> <div class="language-md line-numbers-mode"><pre class="language-md"><code>&lt;&lt;&lt; @/filepath
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p>它也支持 <a href="#%E4%BB%A3%E7%A0%81%E5%9D%97%E4%B8%AD%E7%9A%84%E8%A1%8C%E9%AB%98%E4%BA%AE">行高亮</a>：</p> <div class="language-md line-numbers-mode"><pre class="language-md"><code>&lt;&lt;&lt; @/filepath{highlightLines}
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p><strong>输入</strong></p> <div class="language- line-numbers-mode"><pre class="language-text"><code>&lt;&lt;&lt; @/../@vuepress/markdown/__tests__/fragments/snippet.js{2}
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p><strong>输出</strong></p> <div class="language-js line-numbers-mode"><div class="highlight-lines"><br><div class="highlighted"> </div><br><br></div><pre class="language-js"><code><span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token keyword">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token comment">// ..</span>
<span class="token punctuation">}</span>
</code></pre><div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br></div></div> <div class="custom-block tip"><p class="custom-block-title">注意</p> <p>由于代码段的导入将在 webpack 编译之前执行，因此你无法使用 webpack 中的路径别名，此处的 <code>@</code> 默认值是 <code>process.cwd()</code>。</p></div> <p>为了只导入对应部分的代码，你也可运用 <a href="https://code.visualstudio.com/docs/editor/codebasics#_folding" target="_blank" rel="noopener noreferrer">VS Code region<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>。你可以在文件路径后方的 <code>#</code> 紧接着提供一个自定义的区域名称（预设为 <code>snippet</code> ）</p> <p><strong>输入</strong></p> <div class="language-md line-numbers-mode"><pre class="language-md"><code>&lt;&lt;&lt; @/../@vuepress/markdown/<span class="token bold"><span class="token punctuation">__</span><span class="token content">tests</span><span class="token punctuation">__</span></span>/fragments/snippet-with-region.js#snippet{1}
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><p><strong>代码文件</strong></p> <div class="language-js line-numbers-mode"><pre class="language-js"><code><span class="token comment">// #region snippet</span>
<span class="token keyword">function</span> <span class="token function">foo</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">return</span> <span class="token punctuation">(</span><span class="token punctuation">{</span>
    dest<span class="token operator">:</span> <span class="token string">'../../vuepress'</span><span class="token punctuation">,</span>
    locales<span class="token operator">:</span> <span class="token punctuation">{</span>
      <span class="token string">'/'</span><span class="token operator">:</span> <span class="token punctuation">{</span>
        lang<span class="token operator">:</span> <span class="token string">'en-US'</span><span class="token punctuation">,</span>
        title<span class="token operator">:</span> <span class="token string">'VuePress'</span><span class="token punctuation">,</span>
        description<span class="token operator">:</span> <span class="token string">'Vue-powered Static Site Generator'</span>
      <span class="token punctuation">}</span><span class="token punctuation">,</span>
      <span class="token string">'/zh/'</span><span class="token operator">:</span> <span class="token punctuation">{</span>
        lang<span class="token operator">:</span> <span class="token string">'zh-CN'</span><span class="token punctuation">,</span>
        title<span class="token operator">:</span> <span class="token string">'VuePress'</span><span class="token punctuation">,</span>
        description<span class="token operator">:</span> <span class="token string">'Vue 驱动的静态网站生成器'</span>
      <span class="token punctuation">}</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    head<span class="token operator">:</span> <span class="token punctuation">[</span>
      <span class="token punctuation">[</span><span class="token string">'link'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> rel<span class="token operator">:</span> <span class="token string">'icon'</span><span class="token punctuation">,</span> href<span class="token operator">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">/logo.png</span><span class="token template-punctuation string">`</span></span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token punctuation">[</span><span class="token string">'link'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> rel<span class="token operator">:</span> <span class="token string">'manifest'</span><span class="token punctuation">,</span> href<span class="token operator">:</span> <span class="token string">'/manifest.json'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token punctuation">[</span><span class="token string">'meta'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> name<span class="token operator">:</span> <span class="token string">'theme-color'</span><span class="token punctuation">,</span> content<span class="token operator">:</span> <span class="token string">'#3eaf7c'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token punctuation">[</span><span class="token string">'meta'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> name<span class="token operator">:</span> <span class="token string">'apple-mobile-web-app-capable'</span><span class="token punctuation">,</span> content<span class="token operator">:</span> <span class="token string">'yes'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token punctuation">[</span><span class="token string">'meta'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> name<span class="token operator">:</span> <span class="token string">'apple-mobile-web-app-status-bar-style'</span><span class="token punctuation">,</span> content<span class="token operator">:</span> <span class="token string">'black'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token punctuation">[</span><span class="token string">'link'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> rel<span class="token operator">:</span> <span class="token string">'apple-touch-icon'</span><span class="token punctuation">,</span> href<span class="token operator">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">/icons/apple-touch-icon-152x152.png</span><span class="token template-punctuation string">`</span></span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token punctuation">[</span><span class="token string">'link'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> rel<span class="token operator">:</span> <span class="token string">'mask-icon'</span><span class="token punctuation">,</span> href<span class="token operator">:</span> <span class="token string">'/icons/safari-pinned-tab.svg'</span><span class="token punctuation">,</span> color<span class="token operator">:</span> <span class="token string">'#3eaf7c'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token punctuation">[</span><span class="token string">'meta'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> name<span class="token operator">:</span> <span class="token string">'msapplication-TileImage'</span><span class="token punctuation">,</span> content<span class="token operator">:</span> <span class="token string">'/icons/msapplication-icon-144x144.png'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token punctuation">[</span><span class="token string">'meta'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> name<span class="token operator">:</span> <span class="token string">'msapplication-TileColor'</span><span class="token punctuation">,</span> content<span class="token operator">:</span> <span class="token string">'#000000'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span>
    <span class="token punctuation">]</span>
  <span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span>
<span class="token comment">// #endregion snippet</span>

<span class="token keyword">export</span> <span class="token keyword">default</span> foo
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br></div></div> <p><strong>输出</strong></p> <div class="language-js line-numbers-mode"><div class="highlight-lines"><br><br><br><div class="highlighted"> </div><div class="highlighted"> </div><div class="highlighted"> </div><div class="highlighted"> </div><div class="highlighted"> </div><div class="highlighted"> </div><div class="highlighted"> </div><div class="highlighted"> </div><div class="highlighted"> </div><div class="highlighted"> </div><div class="highlighted"> </div><div class="highlighted"> </div><br><br><br><br><br><br><br><br><br><br><br><br><br></div><pre class="language-js"><code><span class="token keyword">function</span> <span class="token function">foo</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
  <span class="token keyword">return</span> <span class="token punctuation">(</span><span class="token punctuation">{</span>
    dest<span class="token operator">:</span> <span class="token string">'../../vuepress'</span><span class="token punctuation">,</span>
    locales<span class="token operator">:</span> <span class="token punctuation">{</span>
      <span class="token string">'/'</span><span class="token operator">:</span> <span class="token punctuation">{</span>
        lang<span class="token operator">:</span> <span class="token string">'en-US'</span><span class="token punctuation">,</span>
        title<span class="token operator">:</span> <span class="token string">'VuePress'</span><span class="token punctuation">,</span>
        description<span class="token operator">:</span> <span class="token string">'Vue-powered Static Site Generator'</span>
      <span class="token punctuation">}</span><span class="token punctuation">,</span>
      <span class="token string">'/zh/'</span><span class="token operator">:</span> <span class="token punctuation">{</span>
        lang<span class="token operator">:</span> <span class="token string">'zh-CN'</span><span class="token punctuation">,</span>
        title<span class="token operator">:</span> <span class="token string">'VuePress'</span><span class="token punctuation">,</span>
        description<span class="token operator">:</span> <span class="token string">'Vue 驱动的静态网站生成器'</span>
      <span class="token punctuation">}</span>
    <span class="token punctuation">}</span><span class="token punctuation">,</span>
    head<span class="token operator">:</span> <span class="token punctuation">[</span>
      <span class="token punctuation">[</span><span class="token string">'link'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> rel<span class="token operator">:</span> <span class="token string">'icon'</span><span class="token punctuation">,</span> href<span class="token operator">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">/logo.png</span><span class="token template-punctuation string">`</span></span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token punctuation">[</span><span class="token string">'link'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> rel<span class="token operator">:</span> <span class="token string">'manifest'</span><span class="token punctuation">,</span> href<span class="token operator">:</span> <span class="token string">'/manifest.json'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token punctuation">[</span><span class="token string">'meta'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> name<span class="token operator">:</span> <span class="token string">'theme-color'</span><span class="token punctuation">,</span> content<span class="token operator">:</span> <span class="token string">'#3eaf7c'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token punctuation">[</span><span class="token string">'meta'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> name<span class="token operator">:</span> <span class="token string">'apple-mobile-web-app-capable'</span><span class="token punctuation">,</span> content<span class="token operator">:</span> <span class="token string">'yes'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token punctuation">[</span><span class="token string">'meta'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> name<span class="token operator">:</span> <span class="token string">'apple-mobile-web-app-status-bar-style'</span><span class="token punctuation">,</span> content<span class="token operator">:</span> <span class="token string">'black'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token punctuation">[</span><span class="token string">'link'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> rel<span class="token operator">:</span> <span class="token string">'apple-touch-icon'</span><span class="token punctuation">,</span> href<span class="token operator">:</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">/icons/apple-touch-icon-152x152.png</span><span class="token template-punctuation string">`</span></span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token punctuation">[</span><span class="token string">'link'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> rel<span class="token operator">:</span> <span class="token string">'mask-icon'</span><span class="token punctuation">,</span> href<span class="token operator">:</span> <span class="token string">'/icons/safari-pinned-tab.svg'</span><span class="token punctuation">,</span> color<span class="token operator">:</span> <span class="token string">'#3eaf7c'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token punctuation">[</span><span class="token string">'meta'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> name<span class="token operator">:</span> <span class="token string">'msapplication-TileImage'</span><span class="token punctuation">,</span> content<span class="token operator">:</span> <span class="token string">'/icons/msapplication-icon-144x144.png'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
      <span class="token punctuation">[</span><span class="token string">'meta'</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> name<span class="token operator">:</span> <span class="token string">'msapplication-TileColor'</span><span class="token punctuation">,</span> content<span class="token operator">:</span> <span class="token string">'#000000'</span> <span class="token punctuation">}</span><span class="token punctuation">]</span>
    <span class="token punctuation">]</span>
  <span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span></code></pre><div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br></div></div> <h2 id="进阶配置"><a href="#进阶配置" class="header-anchor">#</a> 进阶配置</h2> <p>VuePress 使用 <a href="https://github.com/markdown-it/markdown-it" target="_blank" rel="noopener noreferrer">markdown-it<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 来渲染 Markdown，上述大多数的拓展也都是通过自定义的插件实现的。想要进一步的话，你可以通过 <code>.vuepress/config.js</code> 的 <code>markdown</code> 选项，来对当前的 <code>markdown-it</code> 实例做一些自定义的配置：</p> <div class="language-js line-numbers-mode"><pre class="language-js"><code>module<span class="token punctuation">.</span>exports <span class="token operator">=</span> <span class="token punctuation">{</span>
  markdown<span class="token operator">:</span> <span class="token punctuation">{</span>
    <span class="token comment">// markdown-it-anchor 的选项</span>
    anchor<span class="token operator">:</span> <span class="token punctuation">{</span> permalink<span class="token operator">:</span> <span class="token boolean">false</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token comment">// markdown-it-toc 的选项</span>
    toc<span class="token operator">:</span> <span class="token punctuation">{</span> includeLevel<span class="token operator">:</span> <span class="token punctuation">[</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">]</span> <span class="token punctuation">}</span><span class="token punctuation">,</span>
    <span class="token function-variable function">extendMarkdown</span><span class="token operator">:</span> <span class="token parameter">md</span> <span class="token operator">=&gt;</span> <span class="token punctuation">{</span>
      <span class="token comment">// 使用更多的 markdown-it 插件!</span>
      md<span class="token punctuation">.</span><span class="token function">use</span><span class="token punctuation">(</span><span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'markdown-it-xxx'</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">}</span>
  <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br></div></div></div> <footer class="page-edit"><div class="edit-link"><a href="https://github.com/algate/manoeasy/edit/main/manoeasy/docs/docs/guide/markdown.md" target="_blank" rel="noopener noreferrer">在 GitHub 上编辑此页</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></div> <div class="last-updated"><span class="prefix">最后更新:</span> <span class="time">10/28/2020, 10:08:53 AM</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/manoeasy/guide/assets.html" class="prev">
        静态资源
      </a></span> <span class="next"><a href="/manoeasy/guide/using-vue.html">
        在 Markdown 中 使用 Vue
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"><div class="back-to-ceiling" style="right:1rem;bottom:6rem;width:2.5rem;height:2.5rem;border-radius:.25rem;line-height:2.5rem;display:none;" data-v-14a98f9d data-v-14a98f9d><svg t="1574745035067" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5404" class="icon" data-v-14a98f9d><path d="M526.60727968 10.90185116a27.675 27.675 0 0 0-29.21455937 0c-131.36607665 82.28402758-218.69155461 228.01873535-218.69155402 394.07834331a462.20625001 462.20625001 0 0 0 5.36959153 69.94390903c1.00431239 6.55289093-0.34802892 13.13561351-3.76865779 18.80351572-32.63518765 54.11355614-51.75690182 118.55860487-51.7569018 187.94566865a371.06718723 371.06718723 0 0 0 11.50484808 91.98906777c6.53300375 25.50556257 41.68394495 28.14064038 52.69160883 4.22606766 17.37162448-37.73630017 42.14135425-72.50938081 72.80769204-103.21549295 2.18761121 3.04276886 4.15646224 6.24463696 6.40373557 9.22774369a1871.4375 1871.4375 0 0 0 140.04691725 5.34970492 1866.36093723 1866.36093723 0 0 0 140.04691723-5.34970492c2.24727335-2.98310674 4.21612437-6.18497483 6.3937923-9.2178004 30.66633723 30.70611158 55.4360664 65.4791928 72.80769147 103.21549355 11.00766384 23.91457269 46.15860503 21.27949489 52.69160879-4.22606768a371.15156223 371.15156223 0 0 0 11.514792-91.99901164c0-69.36717486-19.13165746-133.82216804-51.75690182-187.92578088-3.42062944-5.66790279-4.76302748-12.26056868-3.76865837-18.80351632a462.20625001 462.20625001 0 0 0 5.36959269-69.943909c-0.00994388-166.08943902-87.32547796-311.81420293-218.6915546-394.09823051zM605.93803103 357.87693858a93.93749974 93.93749974 0 1 1-187.89594924 6.1e-7 93.93749974 93.93749974 0 0 1 187.89594924-6.1e-7z" p-id="5405" data-v-14a98f9d></path><path d="M429.50777625 765.63860547C429.50777625 803.39355007 466.44236686 1000.39046097 512.00932183 1000.39046097c45.56695499 0 82.4922232-197.00623328 82.5015456-234.7518555 0-37.75494459-36.9345906-68.35043303-82.4922232-68.34111062-45.57627738-0.00932239-82.52019037 30.59548842-82.51086798 68.34111062z" p-id="5406" data-v-14a98f9d></path></svg></div><!----></div></div>
    <script src="/manoeasy/assets/js/app.af965ea1.js" defer></script><script src="/manoeasy/assets/js/4.127e46f3.js" defer></script><script src="/manoeasy/assets/js/10.da3941ef.js" defer></script><script src="/manoeasy/assets/js/7.a765d265.js" defer></script><script src="/manoeasy/assets/js/5.49171081.js" defer></script>
  </body>
</html>
